﻿<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>短期车辆预约申请处理</title>
		<meta name="viewport" content="width=device-width, initial-scale=1" charset="utf-8">
		<link rel="stylesheet" href="../css/bootstrap-3.3.7-dist/css/bootstrap.css">
		<link rel="stylesheet" href="../css/body.css"/>
		<link rel="stylesheet" href="../css/dividePage.css">
		<script src="../js/jQuery.js"></script>
		<script src="../css/bootstrap-3.3.7-dist/js/bootstrap.js"></script>

		
		<script src="../js/index.js"></script>
		<script src="../js/dividePage.js"></script>
		<script>
			if(sessionStorage.token == null){
				alert("请重新登录！")
				location.href = "../index/index.html";
			}
		</script>
		<script>
			document.onkeydown = function () {
			if (window.event && window.event.keyCode == 123) {
				// alert("F12被禁用");
				event.keyCode = 0;
				event.returnValue = false;
			}
			
		}
		</script>
	</head>
	<body>
		<!--首页初始导航条-->
		<nav class="navbar navbar-inverse navbar-fixed-top">
			<div class="container">
				<div class="navbar-header">
					<span class="navbar-brand logo1">川农车辆预约系统</span>
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#m1">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
				</div>
				<div class="navbar-collapse collapse" id="m1">
					<ul class="nav navbar-nav navbar-left">
						<li class="active">
							<a href="../index/index.html"><span class="glyphicon glyphicon-home"></span>&nbsp;首页</a><!--这里的span是设置bootstrap字体图标类-->
						</li>
						
						<!--一个下拉菜单-->
						<!--<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
								长期车辆申请
								<b class="caret"></b>
							</a>
							<ul class="dropdown-menu">
								<li>
									<a href="../index/fileDownload.html">表单下载</a>
								</li>
								<li>
									<a href="../index/longResults.html">结果公示</a>
								</li>
							</ul>
						</li>-->
					</ul>
					
					<div class="nav navbar-nav navbar-right" id="loginWho">
						<li><a href="../index/login.html">登陆</a></li>
					</div>
				</div>
			</div>
		</nav>
		
		<div class="container allStyle">
			<table class="table table-bordered table-striped " id="adminArticle">
				<tr>
					<!-- <th>Id编号</th> -->
					<th>申请人姓名</th>
					<th>车牌号</th>
					<th>申请人电话</th>
					<!--<th>申请校区</th>-->
					<th>申请停放时间</th>
					<th>申请理由</th>
					<th>操作</th>
				</tr>
				<tbody id="tbody">
        		</tbody>
				<!--这个地方会显示回显的后台中的公告数据>-->
			</table>
		</div>
		<div class="pageDiv" id="pageDiv"></div>
		
	</body>
	<script>
		getAllApplication();
		function changePage(e){
				console.log(nowPage);
				console.log(e.getAttribute("value"));
				nowPage = e.getAttribute("value");
				$("#tbody").empty();
				var data3;
				var tbody1 = "";
				$.ajax({
					type: "GET",
					url: "https://carorder.sicau.edu.cn/adminCar/showPendingOrder",
					beforeSend: function (xhr) {
						xhr.setRequestHeader("token", sessionStorage.token);
					},
					dataType: "text", //后台返回格式问题
					data:{
						page:nowPage,
						pageSize:10,	
					},
					success: function(data) {
						// data3 = data
						//console.log(data3);
						// data3 = data3.slice(4);
						data3 = eval('(' + data + ')'); 
						if(data3.total%10 == 0){
							sessionStorage.allPage = parseInt(data3.total/10);
						}else{
							sessionStorage.allPage = parseInt(data3.total/10+1);
						}
						jQuery.each(data3.result, function(i, value) {
							var trs = "<tr><td hidden>" + value.id + "</td> <td>" +value.name+"</td><td>"+ value.plateId + "</td> <td>" + value.phone + "</td><td>";
							
							var res_data = value.beginDate + " 至 " + value.endDate;
							
							
							//同意或拒绝两种操作方法
							trs +=  res_data + "</td><td>"+ value.reason +"<td><a href='javascript:adminYes(" + value.id + ")' class='btn btn-primary btn-xs'>同意</a><a href='javascript:adminNo(" + value.id + ")' class='btn btn-danger btn-xs'>拒绝</a></td>" + "</tr>";

							tbody1 += trs;
						});
						$("#tbody").append(tbody1);
					},
					error: function(data) {
						alert("接收失败,code:" + data.status);
					}
				});
}
function jumpPage(){
	var searchId = $("#pageNum")
	console.log(searchId[0].value);
	nowPage = searchId[0].value
    // console.log(e.getAttribute("value"));
	$("#tbody").empty();
    var data3;
	var tbody1 = "";
	$.ajax({
					type: "GET",
					url: "https://carorder.sicau.edu.cn/adminCar/showPendingOrder",
					beforeSend: function (xhr) {
						xhr.setRequestHeader("token", sessionStorage.token);
					},
					dataType: "text", //后台返回格式问题
					data:{
						page:searchId[0].value,
						pageSize:10,	
					},
					success: function(data) {
						// data3 = data
						//console.log(data3);
						// data3 = data3.slice(4);
						data3 = eval('(' + data + ')'); 
						if(data3.total%10 == 0){
							sessionStorage.allPage = parseInt(data3.total/10);
						}else{
							sessionStorage.allPage = parseInt(data3.total/10+1);
						}
						jQuery.each(data3.result, function(i, value) {
							var trs = "<tr><td hidden>" + value.id + "</td> <td>" +value.name+"</td><td>"+ value.plateId + "</td> <td>" + value.phone + "</td><td>";
							
							var res_data = value.beginDate + " 至 " + value.endDate;
							
							
							//同意或拒绝两种操作方法
							trs +=  res_data + "</td><td>"+ value.reason +"<td><a href='javascript:adminYes(" + value.id + ")' class='btn btn-primary btn-xs'>同意</a><a href='javascript:adminNo(" + value.id + ")' class='btn btn-danger btn-xs'>拒绝</a></td>" + "</tr>";

							tbody1 += trs;
						});
						$("#tbody").append(tbody1);
					},
					error: function(data) {
						alert("接收失败,code:" + data.status);
					}
				});
}
	</script>
	<script type="text/javascript" src="../js/judge.js"></script>
</html>